package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                                                                                                                                                                                                                                                import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.RuleOutMapper;
import com.ruoyi.bizsys.domain.RuleOut;
import com.ruoyi.bizsys.service.IRuleOutService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 规则结果记录Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class RuleOutServiceImpl extends ServiceImpl<RuleOutMapper,RuleOut> implements IRuleOutService {

    /**
     * 查询规则结果记录
     *
     * @param id 规则结果记录ID
     * @return 规则结果记录
     */
    @Override
    public RuleOut selectRuleOutById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询规则结果记录列表
     *
     * @param ruleOut 规则结果记录
     * @return 规则结果记录
     */
    @Override
    public List<RuleOut> selectRuleOutList(RuleOut ruleOut) {
        return this.list(new QueryWrapper<>(ruleOut).last("order by id desc"));
    }

    /**
     * 新增规则结果记录
     *
     * @param ruleOut 规则结果记录
     * @return 结果
     */
            @Override
    public int insertRuleOut(RuleOut ruleOut) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ruleOut.setCreateTime(DateUtils.getNowDate());
                                                return baseMapper.insert(ruleOut);
    }

    /**
     * 修改规则结果记录
     *
     * @param ruleOut 规则结果记录
     * @return 结果
     */
            @Override
    public int updateRuleOut(RuleOut ruleOut) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ruleOut.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(ruleOut);
    }

    /**
     * 批量删除规则结果记录
     *
     * @param ids 需要删除的规则结果记录ID
     * @return 结果
     */
            @Override
    public int deleteRuleOutByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除规则结果记录信息
     *
     * @param id 规则结果记录ID
     * @return 结果
     */
    @Override
    public int deleteRuleOutById(Long id) {
        return baseMapper.deleteById(id);
    }

}
